package io.focus.mijin.zuul.ratelimit.config;

import io.focus.mijin.zuul.ratelimit.config.properties.RateLimitProperties.Policy;

/**
 * @author Marcos Barbero
 * @author Liel Chayoun
 */
public interface RateLimiter {

    String QUOTA_SUFFIX = "-quota";

    /**
     * 消费
     *
     * @param policy      Template for which rates should be created in case there's no rate limit associated with the
     *                    key
     * @param key         Unique key that identifies a request
     * @param requestTime The total time it took to handle the request
     * @return a view of a user's rate request limit
     */
    Rate consume(Policy policy, String key, Long requestTime);
}
